from logic.articleDao import articleDao
from logic.navlistDao import navlistDao
from vo.ViewBaseObject import ViewBaseObject
#首页列表
class IndexListViewObject(ViewBaseObject):
    def __init__(self,p=1):
        self.arts = articleDao().listAll(int(p),20)
        self.p = p
        super().__init__()
#博客列表
class BlogListViewObject(ViewBaseObject):
    def __init__(self,nid,p=1):
        self.arts = articleDao().listNavArt(nid,pageIndex=p,pageCount=20)
        self.navname = navlistDao().getName(nid)
        self.p = p
        super().__init__()

#博客列表内容页
class BlogNavViewObject(ViewBaseObject):
    def __init__(self,obj):
        self.art = obj
        super().__init__()

#首页列表listbuild
def buildIndex(p=1):
    return IndexListViewObject(p)

#博客列表listbuild
def buildBlog(nid,p):
    return BlogListViewObject(nid,p)

